/**
 * 静态方法
 * Name = userGlobal
 * DateTime = Sun Jan 16 2022 21:22:59 GMT+0800 (中国标准时间)
 * Author = Created by zhj9922
 * FileBasename = userGlobal.ts
 * gitee： https://gitee.com/coyeking
 */
import { constant } from "../define/constant";
import { sys } from "cc";
 
export class userGlobal {
	private static _instance: userGlobal;
	
    static get instance () {
        if (this._instance) {
            return this._instance;
        }

        this._instance = new userGlobal();
		this._instance.init();
        return this._instance;
    };
    
    public _userInfo:any = null;
    public _systemInfo:any = null;
	
    private init () {
	
	};
    /**
     * 
     * @returns 获取用户信息
     */
    public getUserInfo(){
        return this._userInfo;
    }
    
    /**
     * 设置用户信息
     * @param data 
     */
    public setUserInfo(data:any)
    {
        this._userInfo = data;
        if (data.token){
            sys.localStorage.setItem(constant.LOCAL_STORAGE.USER_TOKEN,data.token);
        }
    }
    
    /**
     * 
     * @returns 获取系统信息
     */
     public getSystemInfo(){
        return this._systemInfo;
    }
    
    /**
     * 设置系统信息
     * @param data 
     */
    public stSystemInfo(data:any)
    {
        this._systemInfo = data;
    }
}

